import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PromptVO, PromptForm, PromptQuery } from '@/api/aiqa/prompt/types';

/**
 * 查询提示词管理列表
 * @param query
 * @returns {*}
 */

export const listPrompt = (query?: PromptQuery): AxiosPromise<PromptVO[]> => {
  return request({
    url: '/aiqa/prompt/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询提示词管理详细
 * @param id
 */
export const getPrompt = (id: string | number): AxiosPromise<PromptVO> => {
  return request({
    url: '/aiqa/prompt/' + id,
    method: 'get'
  });
};

/**
 * 新增提示词管理
 * @param data
 */
export const addPrompt = (data: PromptForm) => {
  return request({
    url: '/aiqa/prompt',
    method: 'post',
    data: data
  });
};

/**
 * 修改提示词管理
 * @param data
 */
export const updatePrompt = (data: PromptForm) => {
  return request({
    url: '/aiqa/prompt',
    method: 'put',
    data: data
  });
};

/**
 * 删除提示词管理
 * @param id
 */
export const delPrompt = (id: string | number | Array<string | number>) => {
  return request({
    url: '/aiqa/prompt/' + id,
    method: 'delete'
  });
};
